home *** CD-ROM | disk | FTP | other *** search
/ Pascal Super Library / Pascal Super Library (CW International)(1997).bin / SHELLS / SZ2 / GENERAL.PAS < prev    next >
Pascal/Delphi Source File  |  1992-08-31  |  6KB  |  167 lines

  1. {$I compiler }
  2. UNIT General;INTERFACE USES Dos,Crt,Overlay,                     { TP }
  3.                             ExecProc,                        { SHAZAM }
  4.                             Drivers,Memory,HistList,        { RunTime }
  5.                             Objects,Views,Menus,Dialogs,    { RunTime }
  6.                             ColorSel,App,MsgBox,StdDlg,     { Example }
  7.                             HelpFile,                       { Example }
  8.                             Buffers,Editors;                { Example }
  9.    {*******************************************************************
  10.    GENERAL.PAS, Version 2.1    Copyright (c) 1991,92 Johnathan J. Stein
  11.                                                     All Rights Reserved
  12.                                                               WorldWide
  13.    Only for use by Licensed Users of SHAZAM.
  14.  
  15.    STEIN RESEARCH & ENGINEERING                      Voice 419.666.7103
  16.    Post Office Box 346                                 Fax 419.874.4922
  17.    Perrysburg, OH  43552                           CompuServe 76576.470
  18.    USA                                INTERNET 76576.470@compuserve.com
  19.    *******************************************************************}
  20.    {===================================================================
  21.  
  22.    PUBLIC/INTERFACE
  23.  
  24.    ===================================================================}
  25. CONST
  26.    MemoryWarning             : boolean = TRUE ;            { ExitProc }
  27.    VersionCode               : string = '' ;
  28.    AllowBorderColors         : boolean = TRUE ;
  29.  
  30. {$I gMisc.int }
  31. {$I gString.int }
  32. {$I gConvert.int }
  33. {$I gUnsort.int }
  34. {$I gDialog.int }
  35. {$I gEditor.int }
  36. {$I gDesktop.int }
  37. {$I gVideo.int }
  38. {$I gEvent.int }
  39.  
  40. procedure RegisterGeneral ;
  41.  
  42. IMPLEMENTATION
  43.    {===================================================================
  44.  
  45.    PRIVATE/CODE
  46.  
  47.    ===================================================================}
  48. {$I gMisc.imp }
  49. {$I gString.imp }
  50. {$I gConvert.imp }
  51. {$I gUnsort.imp }
  52. {$I gDialog.imp }
  53. {$I gEditor.imp }
  54. {$I gDesktop.imp }
  55. {$I gVideo.imp }
  56. {$I gEvent.imp }
  57.    {===================================================================
  58.  
  59.    REGISTRATION
  60.  
  61.    ===================================================================}
  62. procedure RegisterGeneral ;
  63. begin
  64.    RegisterType ( RSortedCollection ) ;
  65.    RegisterType ( RUnsortedCollection ) ;
  66. end ;
  67.    {|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
  68.  
  69.    EXIT & ERROR
  70.  
  71.    |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||}
  72. VAR
  73.    ExitSave                  : pointer ;
  74.    {===================================================================
  75.  
  76.    HEAPFUNC - Causes New or GetMem to return NIL instead of abort.
  77.  
  78.    Normal Heap Error/Results:
  79.    0 runtime error
  80.    1 return NIL pointer
  81.    2 success & retry
  82.  
  83.    ===================================================================}
  84. function HeapFunc ( Size : word ) : integer ; FAR ;
  85. begin
  86.    HeapFunc                  := 1 ;
  87. end ;
  88.    {===================================================================
  89.  
  90.    EXIT - Clear border, detect undelete/undisposed objects.
  91.  
  92.    ===================================================================}
  93. procedure ExitHandler ; FAR ;
  94. begin
  95.    ExitProc                  := ExitSave ;                   { normal }
  96.    FreeScreen ;                                                { heap }
  97.    NoSound ;                                                   { ears }
  98.    SetBorder ( CRT.Black ) ;                                   { eyes }
  99.    if not MemoryWarning then EXIT ;
  100.    if ( HeapTrapped = 0 ) and
  101.       ( HeapUsed = 0 ) then EXIT ;
  102.    {- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  103.    REMIND - Forgot to free memory!
  104.    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -}
  105.    Buzz ; Buzz ;
  106.    PrintStr ( 'MEMORY NOT RELEASED!  ' +
  107.               NumToStr ( HeapUsed ) + ' bytes used, ' +
  108.               NumToStr ( HeapTrapped ) + ' bytes stuck' +
  109.               #13#10 ) ;
  110. end ;
  111.    {===================================================================
  112.  
  113.    INSTALL
  114.  
  115.    ===================================================================}
  116. procedure InstallExit ;
  117. begin
  118.    ExitSave                  := ExitProc ;
  119.    ExitProc                  := @ExitHandler ;
  120.    HeapError                 := @HeapFunc ;
  121. end ;
  122.    {^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  123.    INITIALIZATION
  124.    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^}
  125. BEGIN
  126.    InstallExit ;
  127. END.
  128.  
  129.    General Purpose code for Turbo Vision.
  130.  
  131.    REGISTRATION VALUES - TStreamRec.ObjType [ 0..65,535 ]
  132.    ------------------------------------------------------
  133.             Range             Used   By
  134.             -----             ----   --
  135.            0..999            0..99   Turbo Vision
  136.          500..600         500..511   DLGDSN & Dialog Editor
  137.                           520..520   FormLine
  138.       1000..65535                    Available range
  139.                     10,000..10,099   Turbo Vision Examples
  140.    60,000..65,535                    SHAZAM  
  141.                     60,000..60,001   this unit
  142.                     60,002..60,006   internal
  143.                     65,535..65,535   generated "PNewStatusLine"
  144.  
  145.  
  146.    COMMAND CONSTANTS - cmXXXX [ 0..65535 ]
  147.    ---------------------------------------
  148.             Range             Used   By
  149.             -----             ----   --
  150.             0..99                    Turbo Vision 
  151.                             80..84   EDITORS
  152.          100..255         100..255   Available (can disable)
  153.          256..999                    Turbo Vision 
  154.      1000..65,535                    Available (can NOT disable)
  155.    60,000..65,535                    SHAZAM 
  156.                     60,000..60,001   TPrint
  157.  
  158.  
  159.    HELP CONTEXT - hcXXXX [ 0..65535 ]
  160.    ----------------------------------
  161.             Range             Used   By
  162.             -----             ----   --
  163.            0..999                    Turbo Vision
  164.                               0..1   No context, View drag
  165.       1000..65535                    Available
  166.      60000..65535                    SHAZAM
  167.